package com.software_product_construction.backend_software_product_construction.controller;

import com.software_product_construction.backend_software_product_construction.service.TestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

import java.util.List;
import java.util.Map;


@Controller
@RequestMapping(value = "/api")
public class TestController {

    @Autowired
    TestService testService;

    public TestController() {
    }



    @GetMapping(value = "/test")
    @ResponseBody
    public Integer[] getArr(Map<String,Object> paramMap){
        System.out.println(paramMap);
        return new Integer[]{1,2,3,4};
    }

    @PostMapping(value = "/test2")
    @ResponseBody
    public String[] getStrArr(@RequestBody Map<String, Object> paramMap){
        return new String[]{"1","2","3"};
    }

    @GetMapping(value = "/test3")
    @ResponseBody
    public String getStr(){
        return "123";
    }

    @GetMapping(value = "/testList")
    @ResponseBody
    public List<String> getStrList(){
        return testService.getAllUsers();
    }



}
